Skip to content

feat: Parse protocolFallbackTTL from FDv2 goodbye - #265

Merged
beekld merged 5 commits into
mainfrom
devin/1794878452-goodbye-fallback-ttl
Nov 18, 2026
Merged

beekld merged 5 commits into
mainfrom
devin/1794878452-goodbye-fallback-ttl

Conversation

@beekld

@beekld beekld commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Parses the optional protocolFallbackTTL field of the FDv2 goodbye payload in launchdarkly-java-sdk-internal, so the server SDK can treat it as an FDv1 fallback directive.

Part of SDK-2987.

  • Goodbye.getProtocolFallbackTTL() and FDv2ActionGoodbye.getProtocolFallbackTTL() return a nullable Duration: null when the field is absent or JSON null, the value in seconds when it is a number, and Duration.ZERO when it is present but not a number.
  • Duration.ZERO works as "use the default TTL", because the spec already treats 0 that way (DATASYSTEM 1.6.1.3–1.6.1.5). A malformed TTL still counts as a directive.
  • Out-of-range clamping and jitter are deliberately left out of this library. The server SDK will apply them in a follow-up PR after this is released.
  • The one-arg constructors are kept, so existing callers still compile.
Implementation details
  • A field-level Gson TypeAdapter on Goodbye.protocolFallbackTTL is needed because existing tests round-trip Goodbye through Gson, and Gson can't reflect into java.time.Duration on JDK 17. parse() reuses the adapter's read logic.
  • Tests cover absent, integer, fractional, 0, negative, >3600, string/bool/object/array (→ ZERO) and JSON null (→ absent), plus pass-through in FDv2ProtocolHandler.
  • Ran ./gradlew test checkstyleMain checkstyleTest in lib/shared/internal.

Link to Devin session: https://app.devin.ai/sessions/cce64c67519f4babaa75176c06961c5e
Open in Devin Desktop: https://app.devin.ai/desktop/session/cce64c67519f4babaa75176c06961c5e?variant=devin
Requested by: @beekld


Note

Overview
Adds optional protocolFallbackTTL to the FDv2 Goodbye payload and threads it through FDv2ProtocolHandler.FDv2ActionGoodbye, so callers can read a server-directed FDv1 fallback delay on disconnect.

Parsing treats absent or JSON null as null, numeric values as seconds (fractional supported), and non-numbers as Duration.ZERO (spec: use default TTL). A custom Gson FallbackTTLAdapter handles round-trip serialization for Duration on JDK 17. One-arg constructors remain for backward compatibility.

Tests cover TTL edge cases in Goodbye.parse and pass-through from handleEvent.

Reviewed by Cursor Bugbot for commit b7d1577. Bugbot is set up for automated code reviews on this repo. Configure here.

devin-ai-integration Bot and others added 4 commits November 17, 2026 01:22
Co-Authored-By: Bee Klimt <bklimt@launchdarkly.com>
Co-Authored-By: Bee Klimt <bklimt@launchdarkly.com>
Co-Authored-By: Bee Klimt <bklimt@launchdarkly.com>
@beekld
beekld requested a review from a team as a code owner November 17, 2026 01:24
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@cursor cursor Bot added the risk:low label Nov 17, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Risk: low.

Automated risk review (dry run): Low

This PR would be automatically approved.

Why: It adds optional protocolFallbackTTL parsing on FDv2 Goodbye and pass-through in FDv2ProtocolHandler, with tests for absent, numeric, and malformed values. There are no infrastructure, auth, or approval-policy changes.

If you disagree with this review, share this PR in #feedback-agent-approvals or submit a changes-requested review explaining why.

Open in Web View Automation 

Sent by Cursor Approval Agent: Dry-Run PR Approver

Co-Authored-By: Bee Klimt <bklimt@launchdarkly.com>
@beekld
beekld merged commit 72d0fe1 into main Nov 18, 2026
31 checks passed
@beekld
beekld deleted the devin/1794878452-goodbye-fallback-ttl branch November 18, 2026 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants